package com.coffeeloversupportlibrary.coffeelover.domain;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import java.util.List;

/**
 * @author puyv
 * @createTime 2021/11/8 11:48
 * @projectName CoffeeLoverSupportLibrary
 * @className FragmentContainerAdapter.java
 * @description TODO   程序主入口 Activity 下Viewpage 的适配器盛放子页面
 *
 */
public class FragmentContainerAdapter extends FragmentStatePagerAdapter {

    private List<Fragment> mFragments;
    private List<String> mTitles;

    public FragmentContainerAdapter(@NonNull FragmentManager fm,List<Fragment> mFragments,List<String> mTitles) {
        // behave 参数？
        super(fm,BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.mFragments=mFragments;
        this.mTitles=mTitles;
    }


    @NonNull
    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }
}
